<?php
ob_start();
session_start();
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] != true)
{
	header('Location: ../login.php');
	exit;
}

header( 'Content-Type: text/html; charset=utf-8' );

$config = array( "host" => $_SESSION['domain'],
				 "port"     => $_SESSION['port'],
		 	  	 "username" => $_SESSION['username'],
		 		 "password" => $_SESSION['password'] );

function __autoload( $klasse )
{
	if (file_exists( strtolower( $klasse ). '.class.php' ))
	{
		include_once( strtolower( $klasse ). '.class.php' );
	}
	else
	{
		if (file_exists( strtolower( "../".$klasse ). '.class.php' ))
		{
			include_once( strtolower( "../".$klasse ). '.class.php' );
		}
	}
}

try
{
	$ftp = FTP::getInstance();
	$ftp->connect( $config );
}
catch (FTPException $error)
{
	echo $error->getMessage();
}

$_SESSION['ftp_sess'] = serialize($ftp);
?>